Technical Q&A TX04
Workaround for Converting Lower to Uppercase Characters while Keeping Diacritical Marks

Q Calling UpperString with a single-character string containing a grave-accent (ASCII $60) returns a lower-case 'a' (ASCII $61). Is this supposed to happen?

A This is a bug that was fixed sometime ago, but the fix broke some file-system code that depends on the incorrect translation.

There is a workaround: To convert lowercase characters to uppercase (keeping diacritical marks), use UppercaseText(). To strip diacritical marks while converting from lowercase to uppercase characters, use UppercaseStripDiacritics(). Both of these routines are described in Inside Macintosh:Text on pages 5-67 through 5-70. Both of these calls use tables in the string-manipulation ('itl2') resource to perform their character-mapping operations, which allows you to customize their operation for different countries.

For example, to convert the Pascal string 'myTestStr' to all uppercase, use UppercaseText() in the following way:

        UppercaseText(myTestStr, myTestStr[0],  smSystemScript);

[May 01 1995]


Developer Documentation | Technical Notes | Development Kits | Sample Code